#标签分布
import pandas as pd


from pyecharts import options as opts
from pyecharts.charts import Pie
from pyecharts.faker import Faker

df=pd.read_csv("二手车基本信息.csv")
lable_num = df['标签'].value_counts().tolist()
lable_type = df['标签'].value_counts().index.tolist()


c = (
    Pie()
    .add("", [list(z) for z in zip(lable_type, lable_num)])
    .set_colors(["yellow", "red", "pink", "orange", "purple","blue", "green",])
    .set_global_opts(title_opts=opts.TitleOpts(title="标签分布"))
    .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
    .render("bigdata/cardata/标签分布.html")
)

